package it.pir.es02ChatTCP;
import javax.swing.*;

public class ChatWindow extends JFrame {

	private static final long serialVersionUID = 4126892105532883232L;
	private JTextArea textArea;
	private JScrollPane scrollPane;
	
	public ChatWindow(){
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		textArea = new JTextArea("--------------------- CHAT DI GRUPPO TCP---------------------\n\n");
		textArea.setFocusable (false);
		textArea.setEditable (false);
		textArea.setLineWrap (true);
		scrollPane = new JScrollPane (textArea,		                                         
		JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,		                                     
		JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		add(scrollPane);
	}
	
	public void addMessage(String message){
		textArea.append(message);
		textArea.append("\n");
	}
}
